import Vue from 'vue'
import VueRouter from 'vue-router'
import home from '../views/home'
import cart from '../views/cart'
import friends from '../views/friends'
import search from '../views/search'
import NewList from '../views/home/news/NewsList/index.vue'
import NewInfo from '../views/home/news/NewsInfo/index.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    component: home,
    meta: {
      title: '首页',
      isShow: true
    }
  },
  {
    path: '/home/newslist',
    component: NewList,
    meta: {
      title: '新闻列表',
      isShow: false
    }
  },
  {
    path: '/home/newsinfo/:id',
    component: NewInfo,
    meta: {
      title: '新闻详情',
      isShow: false
    },
    props: true
  },
  {
    path: '/cart',
    component: cart,
    meta: {
      title: '购物车',
      isShow: true
    }
  },
  {
    path: '/friends',
    component: friends,
    meta: {
      title: '会员',
      isShow: true
    }
  },
  {
    path: '/search',
    component: search,
    meta: {
      title: '搜索',
      isShow: true
    }
  }
]

const router = new VueRouter({
  // mode:history,
  // base:process.env.BASE_URL,
  routes
})

export default router